<?php

require_once dirname(__FILE__).'/../class/functions.php';
require_once dirname(__FILE__).'/../class/user.class.php';

$a = session_id();if(empty($a)) session_start();

if( !isset($_SESSION['logat']) )
    $_SESSION['logat']="NU";

$logat = is_logat();
mysql_safer();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="icon" href="favicon.jpg" type="image/gif" sizes="16x16" /> 
        <link rel="stylesheet" type="text/css" href="../style/style.css" />
        <title>Modifica drepturi</title>
    </head>
<body>
    <? 
      what_header();
      footer();
        ?>
        <div id="content">
            <div id="content_inside">
                    <div id="content_inside_sidebar">
                        <ul>
                            <li><a href ="../index.php"> Home</a><br />
                            </li><li><a href ="../cauta.php"> Cautare</a><br /></li>
                            <li><a href ="../rezervare.php"> Rezervari</a><br /></li>                   
                                           
                         </ul>
                                 
                    </div>
            <div id="content_inside_main">
<?  
if($logat == 0)
    die("Nu v-ati logat");
else
{
    $ok1=1;
    $ok2=1;
    if(isset($_GET['id'])&&( $_SESSION['logat'] == "admin" )) $uid=$_GET['id'];
    else $uid = $_SESSION['id'];
    if(isset($_POST["activ"]))
    {
        $sql_command="Update `utilizatori` Set `activ` = '".$_POST["activ"]."' Where ID = ". $uid."";
        $rezultat=  mysql_query($sql_command);
        if(!$rezultat)
            $ok=0;
    }

    if(isset($_POST["grup"]))
    {
        $sql_command="Update `utilizatori` Set `grup` = '".$_POST["grup"]."' Where ID = ". $uid."";
        $rezultat=  mysql_query($sql_command);
        if(!$rezultat)
            $ok2 = 0;
    }

    if($ok1 == 1 && $ok2==1)
        echo "Modificare reusita";
    else
        echo "Eroare";
    
    if(isset($_SESSION['link_list'][1])) $link=$_SESSION['link_list'][1];
    else $link=$path ."boss/admin.php";
        
    ?>
               
                    <a href="<? echo $link; ?> " class="grey-button pcb"><span>Inapoi</span></a>
                
    <?
}


///print_r($_SESSION);


?>
